<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="root"></div>
<script src="../../javascript/react.development.js"></script>
<script src="../../javascript/react-dom.development.js"></script>
<script src="../../javascript/prop-types.js"></script>
<script src="../../javascript/babel.min.js"></script>
<script type="text/babel">
    /*
    * 函数组件通过函数形参接收props
    * */
    function App(props) {
        return (
            <div className="app">
                <h1>姓名：{props.name}</h1>
                <h1>年龄：{props.age}</h1>
                <h1>性别：{props.sex}</h1>
            </div>
        )
    }

    App.propTypes = {
        name: PropTypes.string.isRequired,
        age: PropTypes.number.isRequired,
        getAge: PropTypes.func
    }
    App.defaultProps = {
        sex: "男"
    }
    ReactDOM.render(<App name="陶品奇" age={22} sex="男"></App>, document.querySelector("#root"))
</script>
</body>
</html>